<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header2.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">中试熟化需求</div>
            <div class="center">
                <div class="requirementDetail" v-if="detail">
                    <div class="top">
                        <div class="top-content">
                            <div class="top-content-title">{{ detail.name }}</div>
                            <div class="top-content-info">
                                <div>所属行业:{{ detail.fieldStr }}</div>
                                <div>
                                    预算金额: {{ detail.budgetAmount }}
                                    <span v-if="detail.isConsult&&detail.isConsult.value == 0">万元</span>
                                </div>
                                <div>需求公示截止日:{{ detail.closingDate }}</div>
                                <div>联系电话: {{ detail.mobile }}</div>
                            </div>
                        </div>
                    </div>
                    <div class="add-box" style="margin-top:2rem"><div class="add-title">需求说明</div></div>
                    <div class="text-box">{{ detail.introduction }}</div>

                    <div class="add-box" style="margin-top:2rem"><div class="add-title">联系人员</div></div>
                    <div class="text-box">{{ detail.person }}</div>
                    <div class="add-box" style="margin-top:2rem"><div class="add-title">微信</div></div>
                    <div class="text-box">{{ detail.weChat }}</div>
                    <div class="add-box" style="margin-top:2rem"><div class="add-title">联系邮箱</div></div>
                    <div class="text-box">{{ detail.email }}</div>
                    <div class="add-box" style="margin-top:2rem"><div class="add-title">单位名称</div></div>
                    <div class="text-box">{{ detail.corporateName }}</div>
                    <div class="add-box" style="margin-top:2rem"><div class="add-title">详细地址</div></div>
                    <div class="text-box">{{ detail.address }}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { sampleDetail } from '../../../../../api/incubation'
const router = useRouter()
const pageAct = ref(1)
const dates = ref('')
const route = useRoute()

const detail = ref(undefined)

const getSampleDetail = () => {
    sampleDetail(route.query.id).then((res) => {
        if (res.code == 200) {
            detail.value = res.data
        }
    })
}

//判断时间是否为个位数，如果时间为个位数就在时间之前补上一个“0”
const check = (val) => {
    if (val < 10) {
        return '0' + val
    } else {
        return val
    }
}

const gotoScreen = (act) => {
    router.push({
        path: '/bigScreen',
        query: {
            act: act,
        },
    })
}
const gotoHome = (act) => {
    router.push({
        path: '/bigScreenIndex',
    })
}
const backToOne = (act) => {
    router.go(-1)
}

const goBack = () => {
    router.push('/chart')
}

// gotoHome() {
//             router.push({
//                 path: '/bigScreenIndex',
//             })
//         },
//         backToOne() {
//             router.go(-1)
//         },

const displayTime = () => {
    //获取系统当前的年、月、日、小时、分钟、毫秒
    let date = new Date()
    let year = date.getFullYear()
    let month = date.getMonth() + 1
    let day = date.getDate()
    let hour = date.getHours()
    let minutes = date.getMinutes()
    let seconds = date.getSeconds()
    dates.value = `${year}年${month}月${day}日 ${check(hour)}:${check(minutes)}:${check(seconds)}`
}
//每隔1秒调用一次displayTime函数
const start = () => {
    setInterval(() => {
        displayTime()
    }, 1000) //单位是毫秒
}
onMounted(() => {
    start()
    getSampleDetail()
})
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(130deg,#2385df 0%,rgba(35, 133, 223, 0.65) 92%)1;
        overflow: auto;
    }

    .center::-webkit-scrollbar {
        display: none;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}
.requirementDetail {
    .top {
        width: 100%;
        height: 24rem;
        background-size: 100% 100%;

        .top-content {
            width: 136rem;
            text-align: center;
            padding: 6rem 0;
            margin: 0 auto;

            .top-content-title {
                font-size: 3.2rem;
                color: #ffffff;
            }

            .top-content-info {
                display: flex;
                justify-content: space-between;
                font-size: 1.6rem;
                color: #d4d4d4;
                margin-top: 4rem;
            }
        }
    }

    .add-box {
        width: 136rem;
        height: 6.5rem;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid #1F75C7;
        .add-title {
            display: flex;
            align-items: center;
            font-size: 2.2rem;
            font-weight: bold;
            color: #1F75C7;
            &::before {
                content: '';
                display: block;
                width: 0.5rem;
                height: 3rem;
                background: #1F75C7;
                margin-right: 1rem;
            }
        }
        .add-btn {
            width: 13rem;
            height: 4.5rem;
            text-align: center;
            line-height: calc(4.5rem - 4px);
            border-radius: 4px;
            border: 1px solid #ffffff;
            font-size: 1.6rem;
            color: #ffffff;
            cursor: pointer;
        }
    }

    .text-box {
        width: 136rem;
        padding: 2rem 0 4rem 0;
        margin: 0 auto;
        color: #d4d4d4;
        font-size: 1.8rem;
    }
}
</style>
